package cur.tool.common.captcha;


import java.io.File;


public class TestCaptcha {
    public static void main(String[] args) {
        // 定义图形验证码的长和宽(配置默认值)
//        LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
//        lineCaptcha.write(new File("./captcha.png"));
//        System.out.println(lineCaptcha.getCode());

//        ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 45, 4, 4);
//        // 自定义验证码内容为四则运算方式
//        captcha.setGenerator(new MathGenerator());
//        // 重新生成code
//        captcha.createCode();
//        captcha.write(new File("./captcha.png"));
//        System.out.println(captcha.getCode());


        // 生成验证码图片，使用自定义背景
        CustomLineCaptcha customLineCaptcha = new CustomLineCaptcha(200, 100,new File("background.jpg"));
        customLineCaptcha.write(new File("./captcha.png"));
        System.out.println(customLineCaptcha.getCode());
//        BufferedImage captchaImage = CaptchaUtil.createImage(backgroundImage);

    }
}
